<template>
    <div>
        <router-link :to="'/home/ss'">
            <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" />
        </router-link>
        
        <van-tabs v-model:active="active" animated>
            <van-tab title="推荐">推荐</van-tab>
            <van-tab title="特惠">特惠</van-tab>
            <van-tab title="美妆">美妆</van-tab>
            <van-tab title="零食">零食</van-tab>
            <van-tab title="电器">电器</van-tab>
            <van-tab title="服装">服装</van-tab>
            <van-tab title="养生">养生</van-tab>
            <van-tab title="饮品">饮品</van-tab>
        </van-tabs>
        <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="image in images" :key="image">
                <img :src="image" style="width: 100%;height: 200px;" />
            </van-swipe-item>
        </van-swipe>

        <van-grid :column-num="4">
            <van-grid-item v-for="item in catitems" :icon="item.image_src" :text="item.name" />
        </van-grid>

        <div v-for="item in floordata">
            <img :src="item.floor_title.image_src
                " alt="" style="width: 100%;">
            <div v-for="items in item.product_list">
                <img :src="items.image_src" alt="" style="width: 100%;height: 240px;">
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue';
const active = ref(0);
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
];
import { catitemsApi, floordataApi } from '@/api/api'
let catitems = ref([])
catitemsApi().then(res => {
    console.log('导航', res)
    catitems.value = res.data.message
})
let floordata = ref([])
floordataApi().then(res => {
    console.log('楼层', res)
    floordata.value = res.data.message
})
</script>

<style lang="scss" scoped></style>